<template src="./index.html"></template>

<script>
import MedicalRecordFamilyMedicalHistoryService from "../../../../../_services/medicalRecordFamilyMedicalHistory.service";
export default {
  name: "TianDingPatientMeFamilyHistoryComponent",
  data() {
    return {
      familyMedicalHistoryList: []
    };
  },
  mounted() {
    this.getFamilyMedicalHistoryList();
  },
  methods: {
    getFamilyMedicalHistoryList() {
      this.indicator$.open("正在加载...");
      let user = JSON.parse(this.local$.getItem("tdUser"));
      let params = {};
      params.userid = user.UserID;
      MedicalRecordFamilyMedicalHistoryService.getFamilyMedicalHistoryListByUserID(
        params
      ).then(response => {
        if (response && response.Data.length > 0) {
          this.familyMedicalHistoryList = response.Data;
        }
        this.indicator$.close();
      });
    },
    btnModify(item) {
      this.local$.removeItem("tdFamilyHistory");
      if (item !== undefined) {
        this.local$.setItem("tdFamilyHistory", JSON.stringify(item));
        this.$router.push({
          name: "tdPatientMeMedicalFamilyHistoryModify",
          params: item
        });
      } else {
        this.$router.push({
          name: "tdPatientMeMedicalFamilyHistoryModify"
        });
      }
    },
    btnPrev() {
      let menu = JSON.parse(this.local$.getItem("tdMeLeftMenus"));
      menu.prev = "prev";
      this.$emit("change", menu);
    },
    btnNext() {
      let menu = JSON.parse(this.local$.getItem("tdMeLeftMenus"));
      menu.next = "next";
      this.$emit("change", menu);
    }
  }
};
</script>

